export function formatDate() {
  // 格式化时间为 YYYY-MM-DD HH:MM:SS
  const date = new Date();
  const year = date.getFullYear();
  const month = date.getMonth() + 1;
  const day = date.getDate();
  const hours = date.getHours();
  const minutes = date.getMinutes();
  const seconds = date.getSeconds(); // 判断是不是小于10 返回01 02 03
  function check(num) {
    if (num < 10) {
      // 如果数字小于10,前边拼接个0
      return "0" + num;
    } else {
      return num;
    }
  }
  let now_day = `${check(year)}年${check(month)}月${check(day)}日  `;
  let now_time = `${check(hours)} : ${check(minutes)} : ${check(seconds)}`
  let nowDay = date.getDay();
  let weeks = ["星期日",
    "星期一",
    "星期二",
    "星期三",
    "星期四",
    "星期五",
    "星期六"];
  let week = weeks[nowDay]; // let state = ``; // // 判断当前时间段 // if (hours >= 0 && hours <= 10) { //   state = `早上`; // } else if (hours > 10 && hours <= 14) { //   state = `中午`; // } else if (hours > 14 && hours <= 18) { //   state = `下午`; // } else if (hours > 18 && hours <= 24) { //   state = `晚上`; // }
  return {
    now_day,
    now_time,
    week
  }
}

